home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50b Issue 142 (CD142b) (August 1998).iso / handson / CPPBuild / step3.exe / Unit1.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-06  |  1.0 KB  |  41 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "Unit1.h"
  6. #include "xlist.h"
  7. //---------------------------------------------------------------------------
  8. #pragma resource "*.dfm"
  9. Xlist list;
  10. char s[80];
  11.  
  12. TForm1 *Form1;
  13. //---------------------------------------------------------------------------
  14. __fastcall TForm1::TForm1(TComponent* Owner)
  15.     : TForm(Owner)
  16. {
  17. }
  18. //---------------------------------------------------------------------------
  19. void __fastcall TForm1::AddClick(TObject *Sender)
  20. {
  21. Xlist* p;
  22.  
  23. p = new Xlist;
  24. list.Add(p);
  25. sprintf(s, "There are %d items", list.Count());
  26. Memo1->Lines->Add(s);
  27.     
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TForm1::RemoveClick(TObject *Sender)
  31. {
  32. Xlist *p;
  33.  
  34. p = list.Remove();
  35. if (p != NULL)
  36.     delete p;
  37. sprintf(s, "There are now %d items", list.Count());
  38. Memo1->Lines->Add(s);
  39.  
  40. }
  41. //---------------------------------------------------------------------------